package com.edouardbataille.open.handler
{
	import com.edouardbataille.open.bytes.ByteReader;
	
	import mx.rpc.Fault;
	
	public class FaultParser
	{
		public static function parseFault (data : ByteReader) : Fault
		{
			var errno : uint = data.readMultipleByte(2);
			var diese : String = String.fromCharCode(data.readByte());
			var sqlstate : String = data.readMultiByte(5, "latin1");
			var msg : String = data.readString("latin1");
			var fault : Fault = new Fault (errno.toString(), sqlstate, msg);
			return fault;
		}

	}
}